Skip to content

[ts-command-line] Escape % characters in help text.#5281

Merged
iclanton merged 4 commits intomicrosoft:mainfrom
iclanton:ts-command-line-sprintf
Jul 23, 2025
Merged

[ts-command-line] Escape % characters in help text.#5281
iclanton merged 4 commits intomicrosoft:mainfrom
iclanton:ts-command-line-sprintf

Conversation

@iclanton
Copy link
Member

Summary

Fixes #5278.

How it was tested

Added test cases.

Impacted documentation

None.

@iclanton iclanton merged commit db406bd into microsoft:main Jul 23, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from Needs triage to Closed in Bug Triage Jul 23, 2025
// Escape sprintf-style escape characters
// The primary special character in sprintf format strings is '%'
// which introduces format specifiers like %s, %d, %f, etc.
return input.replace(/%/g, '%%');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reviewing the source code for sprintf-js@1.0.3, this looks like a complete solution for ensuring the string will not be modified. 👍👍

@iclanton iclanton deleted the ts-command-line-sprintf branch July 23, 2025 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

[ts-command-line] error: [sprintf] unexpected placeholder

3 participants